package com.ruoyi.system.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;

/**
 * @author Ericcc
 * @version v0.01
 * @date 2021/2/2
 */
public class SysUserAccount
{
    private static final long serialVersionUID = 1L;

    /** 商户id */
    private Long userId;

    /** 可结算金额 */
    @Excel(name = "可结算金额")
    private BigDecimal balance;

    /** 未结算金额 */
    @Excel(name = "未结算金额")
    private BigDecimal outstandingBalance;

    /** 冻结金额 */
    @Excel(name = "冻结金额")
    private BigDecimal freezeBalance;

    /** 版本号 */
    private Long version;

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }
    public void setBalance(BigDecimal balance)
    {
        this.balance = balance;
    }

    public BigDecimal getBalance()
    {
        if (balance==null){
            balance = BigDecimal.ZERO;
        }
        return new BigDecimal(balance.stripTrailingZeros().toPlainString());
    }
    public void setOutstandingBalance(BigDecimal outstandingBalance)
    {
        this.outstandingBalance = outstandingBalance;
    }

    public BigDecimal getOutstandingBalance()
    {
        if (outstandingBalance==null){
            outstandingBalance = BigDecimal.ZERO;
        }
        return new BigDecimal(outstandingBalance.stripTrailingZeros().toPlainString());
    }
    public void setFreezeBalance(BigDecimal freezeBalance)
    {
        this.freezeBalance = freezeBalance;
    }

    public BigDecimal getFreezeBalance()
    {
        if (freezeBalance==null){
            freezeBalance = BigDecimal.ZERO;
        }
        return new BigDecimal(freezeBalance.stripTrailingZeros().toPlainString());
    }
    public void setVersion(Long version)
    {
        this.version = version;
    }

    public Long getVersion()
    {
        return version;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("userId", getUserId())
                .append("balance", getBalance())
                .append("outstandingBalance", getOutstandingBalance())
                .append("freezeBalance", getFreezeBalance())
                .append("version", getVersion())
                .toString();
    }
}
